<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=0">

		<title>订单管理</title>

		<link href="/static/user/AmazeUI-2.4.2/assets/css/admin.css" rel="stylesheet" type="text/css">
		<link href="/static/user/AmazeUI-2.4.2/assets/css/amazeui.css" rel="stylesheet" type="text/css">

		<link href="/static/user/css/personal.css" rel="stylesheet" type="text/css">
		<link href="/static/user/css/orstyle.css" rel="stylesheet" type="text/css">

		<script src="/static/user/AmazeUI-2.4.2/assets/js/jquery.min.js"></script>
		<script src="/static/user/AmazeUI-2.4.2/assets/js/amazeui.js"></script>

		<style>
			#searchInput{
				text-indent: 10px;
			}
		</style>

	</head>

	<body>
		<!--头 -->
		<header>
			<article>
				<div class="mt-logo">
					<!--顶部导航条 -->
					<div class="am-container header">
						<ul class="message-r">
							<div class="topMessage home">
								<div class="menu-hd"><a href="/" target="_top" class="h">商城首页</a></div>
							</div>
							<div class="topMessage my-shangcheng">
								<div class="menu-hd MyShangcheng"><a href="/person" target="_top"><i class="am-icon-user am-icon-fw"></i>个人中心</a></div>
							</div>
							<div class="topMessage mini-cart">
								<div class="menu-hd"><a id="mc-menu-hd" href="#" target="_top"><i class="am-icon-shopping-cart  am-icon-fw"></i><span>购物车</span><strong id="J_MiniCartNum" class="h">0</strong></a></div>
							</div>
							<div class="topMessage favorite">
								<div class="menu-hd"><a href="/user/user/logout" target="_top"><i class="am-icon-power-off am-icon-fw"></i><span>退出</span></a></div>
							</div>
							</ul>
						</div>

						<!--悬浮搜索框-->

						<div class="nav white">
							<div class="logoBig">
								<a href="/"><img src="/static/user/images/guangonglogo.jpg"/></a>
							</div>

							<div class="search-bar pr">
								<a name="index_none_header_sysc" href="#"></a>
								<form action="/user/index/search" method="GET">
									<input id="searchInput" name="name" type="text" placeholder="搜索" autocomplete="off">
									<input id="ai-topsearch" class="submit am-btn" value="搜索" index="1" type="submit">
								</form>
							</div>
						</div>

						<div class="clear"></div>
					</div>
				</div>
			</article>
		</header>

		<b class="line"></b>
		<div class="center">
			<div class="col-main">
				<div class="main-wrap">

					<div class="user-order">

						<!--标题 -->
						<div class="am-cf am-padding">
							<div class="am-fl am-cf"><strong class="am-text-danger am-text-lg">订单管理</strong> / <small>Order</small></div>
						</div>
						<hr/>

						<div class="am-tabs am-tabs-d2 am-margin" data-am-tabs>

							<ul class="am-avg-sm-5 am-tabs-nav am-nav am-nav-tabs">
								<!-- <li class="am-active"><a href="#tab1">所有订单</a></li> -->
								<li onclick="window.location.href='order?act1=1'" {if $act1!=0}class="am-active"{/if}><a  href="#tab1">待付款</a></li>
								<li onclick="window.location.href='order?act2=1'" {if $act2!=0}class="am-active"{/if}><a href="#tab2">待发货</a></li>
								<li onclick="window.location.href='order?act3=1'" {if $act3!=0}class="am-active"{/if}><a href="#tab3">待收货</a></li>
								<li onclick="window.location.href='order?act4=1'" {if $act4!=0}class="am-active"{/if}><a href="#tab4">待评价</a></li>
							</ul>

							<div class="am-tabs-bd">
								<!-- tab1 -->
								<div {if $act1!=0}class="am-am-tab-panel am-fade am-in am-active"{else}class="am-tab-panel am-fade"{/if}  id="tab1">

									<div class="order-top">
										<div class="th th-item">
											<td class="td-inner">商品</td>
										</div>
										<div class="th th-price">
											<td class="td-inner">单价</td>
										</div>
										<div class="th th-number">
											<td class="td-inner">数量</td>
										</div>
										<div class="th th-operation">
											<td class="td-inner">&nbsp;</td>
										</div>
										<div class="th th-amount">
											<td class="td-inner">合计</td>
										</div>
										<div class="th th-status">
											<td class="td-inner">交易状态</td>
										</div>
										<div class="th th-change">
											<td class="td-inner">交易操作</td>
										</div>
									</div>
									{php}if(!empty($arr)){/php}
									{foreach name="arr" item="vo" key="key1"}
									{php}$price=0;$text='';$goodsid=''{/php}
									<div class="order-main">
										<div class="order-list">
											<div class="order-status1">
												<div class="order-title">
													<div class="dd-num">订单编号：{$key1}</div>
													<span id="expiretime">{$time}</span>s后过期
													<!-- <span>成交时间：2015-12-20</span> -->
													<!--    <em>店铺：小桔灯</em>-->
												</div>
												<div class="order-content">
													<div class="order-left">

														{volist name="$vo" id="k"}
														<ul class="item-list">
															<li class="td td-item">
																<div class="item-pic">
																	<a href="#" class="J_MakePoint">
																		<img src="/static/admin/uploads/{$k.thumb}" class="itempic J_ItemImg">
																	</a>
																</div>
																<div class="item-info">
																	<div class="item-basic-info">
																		<a href="#">
																			<p>{$k.goods_name}</p>
<!--																			<p class="info-little">颜色：12#川南玛瑙-->
<!--																				<br/>包装：裸装 </p>-->
																		</a>
																	</div>
																</div>
															</li>
															<li class="td td-price">
																<div class="item-price">
																	{$k.sale_price}
																</div>
															</li>
															<li class="td td-number">
																<div class="item-number">
																	<span>×</span>{$k.num}
																</div>
															</li>
														</ul>
														{php}$price+=(float)$k['total_price'];
														$goodsid.=$key.',';
														$text.=$k['goods_name'].'×'.$k['num'].',';
														{/php}
															{/volist}

													</div>
													<div class="order-right">



															{php}$text=substr($text,0,-1);$goodsid=substr($goodsid,0,-1);{/php}
														<li class="td td-amount">
															<div class="item-amount">
																合计：{php}echo $price;{/php}
															</div>
														</li>

														<div class="move-right">
															<li class="td td-status">
																<div class="item-status">
																	<p class="Mystatus">等待买家付款</p>
																	<p class="order-info"><a  onclick="cancelorder()">取消订单</a></p>

																</div>
															</li>
															<li class="td td-change">
																<a href="/user/order/MtAliPay?orderid={$key1}&text={php}echo $text{/php}&price={php}echo $price{/php}&goods_id={php}echo $goodsid{/php}">
																<div class="am-btn am-btn-danger anniu">
																	一键支付</div></a>
															</li>
														</div>
													</div>

												</div>
											</div>
										</div>

									</div>
									{/foreach}
									{php}else{
										echo "没有订单";
									}{/php}
								</div>
								<!-- tab2 -->
								<div {if $act2!=0}class="am-am-tab-panel am-fade am-in am-active"{else}class="am-tab-panel am-fade"{/if} id="tab2">
									<div class="order-top">
										<div class="th th-item">
											<td class="td-inner">商品</td>
										</div>
										<div class="th th-price">
											<td class="td-inner">单价</td>
										</div>
										<div class="th th-number">
											<td class="td-inner">数量</td>
										</div>
										<div class="th th-operation">
											<td class="td-inner">&nbsp;</td>
										</div>
										<div class="th th-amount">
											<td class="td-inner">合计</td>
										</div>
										<div class="th th-status">
											<td class="td-inner">交易状态</td>
										</div>
										<div class="th th-change">
											<td class="td-inner">交易操作</td>
										</div>
									</div>


									{foreach name="$waitarr" item="vo" key="key2"}
									{php}$sumprice=0;{/php}
									<div class="order-main">
										<div class="order-list">
											<div class="order-status2">
												<div class="order-title">
													<div class="dd-num">订单编号：<a href="javascript:;">{$key2}</a></div>
													<span>成交时间：2015-12-20</span>
													<!--    <em>店铺：小桔灯</em>-->
												</div>
												<div class="order-content">
													<div class="order-left">
														{volist name="$vo" id="v1"}
														<ul class="item-list">
															<li class="td td-item">
																<div class="item-pic">
																	<a href="#" class="J_MakePoint">
																		<img src="/static/admin/uploads/{$v1.thumb}" class="itempic J_ItemImg">
																	</a>
																</div>
																<div class="item-info">
																	<div class="item-basic-info">
																		<a href="#">
																			<p>{$v1.goods_name}</p>
																		</a>
																	</div>
																</div>
															</li>
															<li class="td td-price">
																<div class="item-price">
																	{$v1.sale_price}
																</div>
															</li>
															<li class="td td-number">
																<div class="item-number">
																	<span>×</span>{$v1.num}
																</div>
															</li>
														</ul>
														{php}$sumprice=$sumprice+(float)$v1['sale_price']*(float)$v1['num']{/php}
														{/volist}

													</div>
													<div class="order-right">
														<li class="td td-amount">
															<div class="item-amount">
																合计：{php}echo $sumprice{/php}
															</div>
														</li>
														<div class="move-right">
															<li class="td td-status">
																<div class="item-status">
																	<p class="Mystatus">买家已付款</p>
																</div>
															</li>
															<li class="td td-change">

																	等待发货
															</li>
														</div>
													</div>
												</div>
											</div>
										</div>
									</div>
									{/foreach}
								</div>
								<!-- tab3 -->
								<div {if $act3!=0}class="am-am-tab-panel am-fade am-in am-active"{else}class="am-tab-panel am-fade"{/if}  id="tab3">
									<div class="order-top">
										<div class="th th-item">
											<td class="td-inner">商品</td>
										</div>
										<div class="th th-price">
											<td class="td-inner">单价</td>
										</div>
										<div class="th th-number">
											<td class="td-inner">数量</td>
										</div>
										<div class="th th-operation">
											<td class="td-inner">&nbsp;</td>
										</div>
										<div class="th th-amount">
											<td class="td-inner">合计</td>
										</div>
										<div class="th th-status">
											<td class="td-inner">交易状态</td>
										</div>
										<div class="th th-change">
											<td class="td-inner">交易操作</td>
										</div>
									</div>
									{foreach name="$getarr" item="vo" key="key2"}
									{php}$sumprice=0;{/php}
									<div class="order-main">
										<div class="order-list">
											<div class="order-status3">
												<div class="order-title">
													<div class="dd-num">订单编号：<a href="javascript:;">{$key2}</a></div>
													<span>成交时间：2015-12-20</span>
													<!--    <em>店铺：小桔灯</em>-->
												</div>
												<div class="order-content">
													<div class="order-left">

														{volist name="$vo" id="v1"}
														<ul class="item-list">
															<li class="td td-item">
																<div class="item-pic">
																	<a href="#" class="J_MakePoint">
																		<img src="/static/admin/uploads/{$v1.thumb}" class="itempic J_ItemImg">
																	</a>
																</div>
																<div class="item-info">
																	<div class="item-basic-info">
																		<a href="#">
																			<p>{$v1.goods_name} </p>
																		</a>
																	</div>
																</div>
															</li>
															<li class="td td-price">
																<div class="item-price">
																	{$v1.sale_price}
																</div>
															</li>
															<li class="td td-number">
																<div class="item-number">
																	<span>×</span>{$v1.num}
																</div>
															</li>
														</ul>
														{php}$sumprice=$sumprice+(float)$v1['sale_price']*(float)$v1['num']{/php}
														{/volist}
													</div>
													<div class="order-right">
														<li class="td td-amount">
															<div class="item-amount">
																合计：{php}echo $sumprice{/php}
															</div>
														</li>
														<div class="move-right">
															<li class="td td-status">
																<div class="item-status">
																	<p class="Mystatus">卖家已发货</p>
																</div>
															</li>
															<li class="td td-change">
																<input type="hidden" value="{$key2}">
																<div class="am-btn am-btn-danger anniu" onclick="changesure(this);">
																	确认收货</div>
															</li>
														</div>
													</div>
												</div>
											</div>
										</div>
									</div>
									{/foreach}
								</div>

								<!-- tab4 -->
								<div {if $act4!=0}class="am-am-tab-panel am-fade am-in am-active"{else}class="am-tab-panel am-fade"{/if} id="tab4">
									<div class="order-top">
										<div class="th th-item">
											<td class="td-inner">商品</td>
										</div>
										<div class="th th-price">
											<td class="td-inner">单价</td>
										</div>
										<div class="th th-number">
											<td class="td-inner">数量</td>
										</div>
										<div class="th th-operation">
											&nbsp;
										</div>
										<div class="th th-amount">
											<td class="td-inner">合计</td>
										</div>

										<div class="th th-status">
											<td class="td-inner">交易状态</td>
										</div>
										<div class="th th-change">
											<td class="td-inner">交易操作</td>
										</div>
									</div>

									<div class="order-main">
										<div class="order-list">
											<!--不同状态的订单	-->
											{volist name="comment" id="c"}
										<div class="order-status4">
												<div class="order-title">
													<div class="dd-num">订单编号：<a href="javascript:;">{$c.order_id}</a></div>
													<span>成交时间：2015-12-20</span>

												</div>
												<div class="order-content">
													<div class="order-left">
														<ul class="item-list">
															<li class="td td-item">
																<div class="item-pic">
																	<a href="#" class="J_MakePoint">
																		<img src="/static/admin/uploads/{$c.thumb}" class="itempic J_ItemImg">
																	</a>
																</div>
																<div class="item-info">
																	<div class="item-basic-info">
																		<a href="#">
																			<p>{$c.goods_name}</p>

																		</a>
																	</div>
																</div>
															</li>
															<li class="td td-price">
																<div class="item-price">
																	{$c.sale_price}
																</div>
															</li>

															<li class="td td-number">
																<div class="item-number">
																	<span>×</span>{$c.num}
																</div>
															</li>
														</ul>

													</div>
													<div class="order-right">

														<div class="move-right">
															<li class="td td-amount">
																<div class="item-amount">
																	合计：{php}$sumprice=(float)$c['sale_price']*(float)$c['num'];echo $sumprice{/php}
																</div>
															</li>
															<li class="td td-status">
																<div class="item-status">
																	<p class="Mystatus">代评价</p>
																</div>
															</li>
															<li class="td td-change">
																<a href="/user/index/sendcomment?id={$c.id}">
																	<div class="am-btn am-btn-danger anniu">
																		评价商品</div>
																</a>
															</li>
														</div>
													</div>

												</div>
											</div>
											{/volist}
										</div>

									</div>

								</div>
							</div>

						</div>
					</div>
				</div>
				<!--底部-->
				<div class="footer">
					<div class="footer-hd">
						<p>
							<a href="/">商城首页</a>
							<b>|</b>
							<a href="https://www.alipay.com/">支付宝</a>
							<b>|</b>
							<a href="https://www.kuaidi100.com/?from=openv">快递查询</a>
						</p>
					</div>
				</div>
			</div>

			<aside class="menu">
				<ul>
					<li class="person">
						<a href="/person">个人中心</a>
					</li>
					<li class="person">
						<a>个人资料</a>
						<ul>
							<li> <a href="/information">个人信息</a></li>
							<li> <a href="/safety">安全设置</a></li>
							<li> <a href="/address">收货地址</a></li>
						</ul>
					</li>
					<li class="person">
						<a>我的交易</a>
						<ul>
							<li class="active"><a href="/order?act1=1">订单管理</a></li>
						</ul>
					</li>


					<li class="person">
						<a>我的小窝</a>
						<ul>
							
							<li> <a href="/comment">评价</a></li>
						</ul>
					</li>

				</ul>

			</aside>
		</div>

	</body>
	<script>
		function cancelorder(){
			$.ajax({
				url:'/user/order/cancelorder',
				success:function (res) {
					console.log(res)
				}
			})
		}
		function changesure(_this) {
			$.ajax({
				url:'/user/order/issure',
				type:'post',
				data:{
					'order_id':$(_this).siblings('input').val()
				},
				success:function (res) {
					window.location.href='order?act4=1';
				}
			})
		}

		$(function () {
   var num={$time};
   var timer=setInterval(function () {
      num--;
      $('#expiretime').html(num);
      if (num<=0){
         clearInterval(timer);
         $('.daizhifu').parent().html('已过期');
      }
   },1000)

})
	</script>
</html>